package com.test.kotlin03

import java.io.File


fun takeIfTest(){
    val  result = File("/Users/lwb/AndroidStudioProjects/demo/KotlinDemo/kotlin01/src/main/java/com/test/kotlin03/i have a dream_copy.txt")
        .takeIf {
            it.exists() && it.canRead()// lambda表达式，返回true或false
        }
        ?.readText()
    println(result)
}

fun main(){
    takeIfTest()
}
